import numpy as np
import matplotlib.pyplot as plt
import os
from matplotlib.colors import LogNorm

# define data directory
fname = 'exfig7.npz'

# load npz file
data = np.load(fname, allow_pickle=True)
print(data.files)
n = data['n']
nu = data['nu']
T = data['T']
Rxx = data['Rxx']
Vtg = data['Vtg']
Vbg = data['Vbg']
n0 = data['n0'] # density at charge neutrality point
ns = data['ns'] # density at 4 electron per moire unit cell
device_name = data['device_name']
back_gate_thickness_nm = data['back_gate_thickness_nm']
top_gate_thickness_nm = data['top_gate_thickness_nm']

# plot
fig, ax = plt.subplots(1, 1, figsize=(6, 3))
fig.suptitle('exfig7')
im = ax.scatter(nu, T, c=Rxx, marker='s', s=3, cmap='inferno', vmin=0, vmax=1e4)
ax.set_xlabel(r'$\nu$')
ax.set_ylabel('$T$ (K)')
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('$R_{xx}$ ($\Omega$)')
plt.show()
